#include "stdafx.h"
#include "texturegroup.h"

namespace GLC {

TextureGroup::TextureGroup()
{
}

TextureGroup::~TextureGroup()
{
    for (size_t index = 0; index < m_textures.size(); ++index)
    {
        delete m_textures[index];
    }
}

size_t TextureGroup::load(const std::string &name)
{
    m_textures.push_back(new Texture2D(name));
    return m_textures.size() - 1;
}

size_t TextureGroup::size() const
{
    return m_textures.size();
}

Texture2DRef TextureGroup::at(size_t index) const
{
//    if (index >= size())
//    {
//        myDebug() << "GLC::TextureGroup::operator[] - index out of range\n";
//    }
//    else
    {
        Texture2D *tex = m_textures[index];
        return Texture2DRef(*tex);
    }
}

} // namespace GLC
